wayland: Add support for BTN_STYLUS3
authorJason Gerecke <killertofu@gmail.com>
Tue, 10 Oct 2017 16:17:43 +0000 (09:17 -0700)
committerCarlos Garnacho <carlosg@gnome.org>
Tue, 30 Jan 2018 20:32:24 +0000 (21:32 +0100)
BTN_STYLUS3 is defined by the Linux 4.15 kernel and is sent when the
third button on a stylus is pressed. At the moment, only Wacom's "Pro
Pen 3D" has three stylus buttons. Pressing this button triggers a button
8 event to be sent under X11, so we use the same mapping here.

https://bugzilla.gnome.org/show_bug.cgi?id=790033

gdk/wayland/gdkdevice-wayland.c

index 0f2afd0f42ad66f22ad33d744578a229f073f0c1..f6d396d5d43c4684e3be8504a7da474381c23f1f 100644 (file)
 
 #define BUTTON_BASE (BTN_LEFT - 1) /* Used to translate to 1-indexed buttons */
 
+#ifndef BTN_STYLUS3
+#define BTN_STYLUS3 0x149 /* Linux 4.15 */
+#endif
+
 typedef struct _GdkWaylandDevicePad GdkWaylandDevicePad;
 typedef struct _GdkWaylandDevicePadClass GdkWaylandDevicePadClass;
 
@@ -3819,6 +3823,8 @@ tablet_tool_handle_button (void                      *data,
     n_button = GDK_BUTTON_SECONDARY;
   else if (button == BTN_STYLUS2)
     n_button = GDK_BUTTON_MIDDLE;
+  else if (button == BTN_STYLUS3)
+    n_button = 8; /* Back */
   else
     return;